package com.seal.tsms.system.entity;

import com.seal.tsms.base.entity.BaseEntity;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by seal.jing on 2015/12/27.
 */
@Entity
@Table(name = "SYS_ROLE")
public class SystemRole extends BaseEntity{
    private String name;
    private String description;
    private int statu;
    private Set<UserRole> UsersRole=new HashSet<UserRole>();
    private Set<RolePermission> rolePermissions=new HashSet<RolePermission>();
    private Set<ResourceRole> resourcesRole=new HashSet<ResourceRole>();

    @OneToMany(cascade = CascadeType.ALL,mappedBy = "role")
    public Set<ResourceRole> getResourcesRole() {
        return resourcesRole;
    }

    public void setResourcesRole(Set<ResourceRole> resourcesRole) {
        this.resourcesRole = resourcesRole;
    }

    @OneToMany(cascade = CascadeType.ALL,mappedBy = "role")
    public Set<RolePermission> getRolePermissions() {
        return rolePermissions;
    }

    public void setRolePermissions(Set<RolePermission> rolePermissions) {
        this.rolePermissions = rolePermissions;
    }

    @OneToMany(cascade = CascadeType.ALL,mappedBy = "role")
    public Set<UserRole> getUsersRole() {
        return UsersRole;
    }

    public void setUsersRole(Set<UserRole> usersRole) {
        UsersRole = usersRole;
    }

    @Column(name="ROLE_NAME")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name="ROLE_DESCRIPTION")
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Column(name="ROLE_STATU")
    public int getStatu() {
        return statu;
    }

    public void setStatu(int statu) {
        this.statu = statu;
    }
}
